# -*- coding: utf-8 -*-
# Defaultdict
# defaultdict对象在当你希望使用它存放追踪数据的时候很有用。
from collections import defaultdict
 
s = "the quick brown fox jumps over the lazy dog"
 
words = s.split()
location = defaultdict(list)
for m, n in enumerate(words):
    location[n].append(m)
 
print location

# 创建multidict的方法
s = "the quick brown fox jumps over the lazy dog"
d = {}
words = s.split()
 
for key, value in enumerate(words):
    d.setdefault(key, []).append(value)
print d